package org.wlw.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.wlw.dao.IUserDao;
import org.wlw.models.User;
import org.wlw.service.IUserService;

import java.util.List;

//@Component
@Service
public class UserService implements IUserService {

    private IUserDao userDao;

    @Autowired
    public void setUserDao(IUserDao userDao) {
        this.userDao = userDao;
    }

    @Override
    public void add(User user) {
        int n = 0;
        for (int i = 0; i < 100; i++) {
            n += i;
        }
        userDao.add(user);
    }

    @Override
    public void delete(int id) {
        userDao.delete(id);
    }

    @Override
    public void update(User user) {
        userDao.update(user);
    }

    @Override
    public User load(int id) {
        return userDao.load(id);
    }

    @Override
    public List<User> list() {
        return userDao.list();
    }
}
